import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpArticle {
  id!: number;
  desc?: string;
  title!: string;
  img!: unknown;
  content!: unknown;
  typeId!: number;
  defaultView: number = 0;
  viewNum: number = 0;
  zanNum: number = 0;
  state: number = 2;
  sort: number = 0;
  uniacid!: number;
  addTime!: string;
  updateTime!: string;
}

export const ImsYzdKpArticleSchema = new EntitySchema({
  class: ImsYzdKpArticle,
  properties: {
    id: { primary: true, type: 'number' },
    desc: { type: 'string', length: 255, nullable: true },
    title: { type: 'string', length: 255 },
    img: { type: 'unknown', columnType: 'longtext' },
    content: { type: 'unknown', columnType: 'longtext' },
    typeId: { type: 'number', index: 'type_id' },
    defaultView: { type: 'number', default: 0 },
    viewNum: { type: 'number', default: 0 },
    zanNum: { type: 'number', default: 0 },
    state: { type: 'number', default: 2, index: 'state' },
    sort: { type: 'number', default: 0, index: 'sort' },
    uniacid: { type: 'number', index: 'uniacid' },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
  },
});
